package com.ktjiaoyu.utils.fastjson2;

import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.filter.PropertyPreFilter;

import java.util.Set;

public class FastJson2SensitivePropFilter implements PropertyPreFilter {
    private Set<String> excludes;

    public FastJson2SensitivePropFilter(Set<String> excludes){
        this.excludes=excludes;
    }
    @Override
    public boolean process(JSONWriter jsonWriter, Object o, String s) {
        if (excludes==null){
            return true;
        }
        boolean isNeed=!excludes.contains(s);
        return isNeed;
    }
}
